<include file="Index/header"/>
<script language="javascript" type="text/javascript" src="__PUBLIC__/My97DatePicker/WdatePicker.js"></script>
<style>
    .teacher {
        margin-left: 20px;
        border: solid 1px #ccc;

    }

    .teacher td {
        height: 50px;
        margin-left: 20px;
        width: 500px;
        border: solid 1px #ccc;
        line-height: 50px;
    }

    .teacher select {

        margin-left: 20px;
    }

    .teacher input {

        margin-left: 20px;

    }

    .input-xlarge {
        width: 600px;
        height: 100px;

    }
</style>

<include file="Index/left"/>


<div class="content">

    <div class="header">

        <h1 class="page-title">添加资料</h1>
    </div>

    <ul class="breadcrumb">
        <li><a href="{:U('Index/Index')}">首页</a> <span class="divider">/</span></li>
        <li><a href="#">档案管理</a> <span class="divider">/</span></li>
        <li class="active">教师信息管理</li>
    </ul>

    <div class="container-fluid">
        <div class="row-fluid">


            <div class="well" id='well2'>
                <ul class="nav nav-tabs">
                    <li class="active"><a href="#home" data-toggle="tab">添加教师</a></li>
                </ul>
                <div id="myTabContent" class="tab-content">
                    <div class="tab-pane active in" id="home">
                        <form id="tab">
                            <table width="95%" border="0" class="teacher">
                                <tr>
                                    <td>&nbsp;&nbsp;<span style="color: red">*</span>教&nbsp;师&nbsp;工&nbsp;号
                                        <input type='text' value='' id="tid" name='tid' class="input-xlarge"
                                               placeholder="请输入教师工号" style="width:50%;margin-top: 2%" maxlength="8">
                                    </td>

                                    <td> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: red">*</span>姓&nbsp;名
                                        <input type="text" value="" id="tname" name="tname" class="input-xlarge"
                                               placeholder="请输入教师姓名" style="width:50%;margin-top: 2%">
                                    </td>

                                    <td>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: red">*</span>性&nbsp;别
                                        <select name="sex" id="sex" style="width:55%;margin-top: 2%">
                                            <option value="">请选择</option>
                                            <option value="男">男</option>
                                            <option value="女">女</option>
                                        </select>
                                    </td>
                                </tr>
                                <tr>
                                    <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;籍&nbsp;贯
                                        <input type="text" value="" name="nation" class="input-xlarge"
                                               style="width:50%;margin-top: 2%">
                                    </td>
                                    <td>&nbsp;&nbsp;入&nbsp;职&nbsp;时&nbsp;间
                                        <input type="text" value="" name="EntryDate" class="input-xlarge"
                                               onClick="WdatePicker()" style="width:50%;margin-top: 2%"></td>
                                    <td>&nbsp;&nbsp; 出&nbsp;生&nbsp;日&nbsp;期
                                        <input type="text" value="" name="Birth" class="input-xlarge"
                                               onClick="WdatePicker()" style="width:50%;margin-top: 2%"></td>
                                </tr>
                                <tr>
                                    <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;电&nbsp;话
                                        <input type="text" value="" name="telephone" class="input-xlarge"
                                               style="width:50%;margin-top: 2%"></td>
                                    <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;手&nbsp;机
                                        <input type="text" value="" name="mobilephone" class="input-xlarge"
                                               style="width:50%;margin-top: 2%"></td>
                                    <td>&nbsp;&nbsp;&nbsp;电&nbsp;子&nbsp;邮&nbsp;件
                                        <input type="text" value="" name="email" class="input-xlarge"
                                               style="width:50%;margin-top: 2%"></td>
                                    </td>
                                </tr>

                                <tr>
                                    <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                        <span style="color: red">*</span>类&nbsp;型
                                        <select name="type" id="type" style="width: 55%">
                                            <option value="">请选择</option>
                                            <option value="1">接班老师</option>
                                            <option value="2">带班老师</option>
                                            <option value="3">值班领导</option>
                                        </select>
                                    </td>
                                </tr>

                                <tr>
                                    <td colspan="3">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;备&nbsp;注&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                        <textarea name="remark" cols="50px" rows="6" id="remark" class="input-xlarge"
                                                  style="width:83.5%;margin-top: 1%"> </textarea></td>
                                </tr>
                                <!-- <tr><td colspan="3">   备&nbsp;&nbsp;&nbsp;&nbsp;注2:&nbsp;&nbsp;&nbsp;&nbsp;
                                         <textarea cols="50" rows="6" name="crc" class="input-xlarge"></textarea></td></tr>--></table>
                            <br/>
                            <div style="margin-left:280px;">
                                <button type="button" class="btn btn-primary" onclick="tj()">
                                    确&nbsp;&nbsp;&nbsp;&nbsp;定
                                </button>&nbsp;&nbsp;&nbsp;&nbsp;
                                <button type="button" class="btn btn-primary" onclick="history.go(-1)">取&nbsp;&nbsp;&nbsp;&nbsp;消</button>
                            </div>
                        </form>
                    </div>

                </div>
            </div>

        </div>


        <footer>
            <hr>


        </footer>

    </div>
</div>
</div>
<script type="text/javascript">
    function tj() {
        var tid = $('#tid').val();
        var tname = $('#tname').val();
        var sex = $('#sex').val();
        var remark = $('#remark').val().length;
        if (remark > 100) {

            alert('备注超过最大字数限制');
            return
        }
        if (tid === '') {
            alert('教师编号不能为空');
            $("#tid").focus();
            return;
        }
        else if (tname === '') {
            alert('教师姓名不能为空');
            $("#tname").focus();
            return;

        }
        if (sex === '') {
            alert('请选择性别');
            $("#sex").focus();
            return;

        }
        $.ajax({
            type: "POST",
            url: "__CONTROLLER__/Addteacher",

            cache: false,
            data: $('#tab').serialize(),

            success: function (data) {
                switch (data) {

                    case '0':
                        alert('添加成功');
                        if (confirm("是否继续添加教师信息")) {
                            location.href = "__CONTROLLER__/Addteacher";
                        } else {
                            window.location.replace("__CONTROLLER__/Teacher")
                        }

                        break;
                    case '1':
                        alert('用户添加失败');

                        break;
                    case '3':
                        alert('工号已存在');
                        break;
                    default:
                        alert(data);
                }

            }


        })


    }
</script>

<script src="__PUBLIC__/lib/bootstrap/js/bootstrap.js"></script>
<script type="text/javascript">
    $("[rel=tooltip]").tooltip();
    $(function () {
        $('.demo-cancel-click').click(function () {
            return false;
        });
    });
</script>

</body>
</html>


